<template>
	<view>
		<view style="width: 100%;">
			<uni-card style="width: 100%;height: 100%; margin: 0 auto;margin-top: 10px;">
				<uni-forms ref="baseForm" style="width: 90%;height: 1450rpx;">
					<uni-forms-item label="日程标题" required>
						<uni-easyinput v-model="schedulename" placeholder="请输入姓名" />
					</uni-forms-item>
					<uni-forms-item label="开始时间">
						<uni-datetime-picker type="datetime" return-type="timestamp" v-model="starttime" />
					</uni-forms-item>
					<uni-forms-item label="结束时间">
						<uni-datetime-picker type="datetime" return-type="timestamp" v-model="overtime" />
					</uni-forms-item>
					<uni-forms-item label="紧急程度" required>
						<uni-easyinput v-model="urgency" placeholder="低/一般/紧急/非常紧急" />
					</uni-forms-item>
					<uni-forms-item label="日程提醒" required>
						<u-switch v-model="value" @change="change"></u-switch>
					</uni-forms-item>
					<uni-forms-item label="日程描述">
						<uni-easyinput type="textarea" v-model="describe" placeholder="请输入日程描述" />
					</uni-forms-item>
					<u-button text="确认提交" @click="rcAdd()" color="linear-gradient(to right, rgb(174, 153, 217), rgb(255, 252, 220))">
					</u-button>
				</uni-forms>
			</uni-card>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				liste: "",
				value: false,
				sname: '',
				sname1: '',
				schedulename: '',
				starttime: '',
				overtime: '',
				urgency: '',
				remind: '',
				describe: '',
			}
		},
		methods: {
			rcAdd(){
				var that = this
				uni.getStorage({
					key: "user",
					success: function(res) {
						that.liste = res.data
					},
					
				});
				uni.request({
					url:'http://localhost:9525/fragmentary/rcAdd',
					method: 'POST',
				   data: {
					   schedulename:this.schedulename,
					   starttime:this.starttime,
					   overtime:this.overtime,
					   urgency:this.urgency,
					   remind:this.value,
					   describe:this.describe,
					   sname:this.liste.name,
				   },
				   dataType:'json',
				   success: (res) => {
					   uni.showToast({
					   	title: "添加成功"
					   });
					},
				})
				// uni.switchTab({
				// 	url:"Richengindex"
				// })
			},
			change(e) {
				// console.log('change', e);
				this.value=e;
				console.log(this.value)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.example {
		padding: 15px;
		background-color: #fff;
	}

	.segmented-control {
		margin-bottom: 15px;
	}

	.button-group {
		margin-top: 15px;
		display: flex;
		justify-content: space-around;
	}

	.form-item {
		display: flex;
		align-items: center;
	}

	.button {
		display: flex;
		align-items: center;
		height: 35px;
		margin-left: 10px;
	}
</style>
